// 重置表格样式
:root {
  .ant-table-wrapper {
    &.table-with-pagination {
      height: calc(100% - 48px);
    }

    //让表格滚动条随内容自适应出现
    .ant-table-body {
      overflow-y: auto !important;
    }

    .ant-table {
      .ant-table-container {
        border-radius: 6px ;
        // border: 1px solid var(--borderColor);
        // border: none;

        // 去除除横向滚动条时的阴影（高度不正确）
        &::before {
          box-shadow: none !important;
        }

        &::after {
          box-shadow: none !important;
        }

        .ant-table-thead {
          tr {
            th {
              background-color: var(--tableHeaderBgColor);
              color: var(--normalColor);
              font-weight: bold;
              height: 39px;
              padding: 4px 8px;
              line-height: 20px;
              font-size: 14px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              border-color: var(--borderColor);

              &.ant-table-selection-column {
                text-overflow: clip;
              }

              // 为合并行的表头加边框
              &[rowspan]:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not(
                  [colspan]
                )::before {
                height: 100%;
                background-color: var(--borderColor);
              }

              &[rowspan]:nth-last-child(2):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not(
                  [colspan]
                )::before {
                background-color: transparent;
              }

              &[rowspan]:not(:last-child):not(:nth-last-child(2)):not(.ant-table-row-expand-icon-cell) {
                border-right: 1px solid var(--borderColor);
                height: 24px;
                padding: 0 8px;
                line-height: 20px;
              }

              &[colspan]:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell) {
                border-right: 1px solid var(--borderColor);
                height: 24px;
                padding: 0 8px;
                line-height: 20px;
                border-bottom: 1px solid var(--borderColor);
              }

              /*表格 表头去掉分割线*/
              &:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not(
                  [colspan]
                )::before {
                content: none;
              }
            }

            td {
              background-color: var(--tableHeaderBgColor);
            }

            // 为合并行的表头加边框
            &:nth-child(2) {
              th {
                &:not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan]) {
                  // border-top: 1px solid var(--borderColor);
                  border-right: 1px solid var(--borderColor);
                  height: 24px;
                  padding: 0 8px;
                  line-height: 20px;
                  font-size: 12px;
                  font-weight: 400;

                  &::before {
                    height: 100%;
                    background-color: transparent;
                  }
                }
              }
            }

            // &:first-child {
            //   th {
            //     &:first-child {
            //       padding-left: 20px;
            //     }

            //     &:nth-last-child(2) {
            //       padding-right: 20px;
            //     }
            //   }
            // }
          }
        }

        // .ant-table-body {
        // border-bottom: 1px solid var(--borderColor);

        .ant-table-tbody {
          // border: 1px solid var(--borderColor);
          // border-top: none;
          // border-bottom-left-radius: 6px;
          // border-bottom-right-radius: 6px;
          .ant-table-row {
            &:nth-child(odd) {
              background: var(--tableZebraColor);
            }
          }
         

          tr {
            height: 40px;

            td {
              // font-size: 12px;
              padding: 4px 8px;
              height: 40px;
              border-color: var(--borderColor);

              .ant-btn-link {
                height: 16px;

                // font-size: 12px;
                // padding: 0 8px;
                & + .ant-btn-link {
                  margin-left: 16px;
                }
              }

              // &:first-child {
              //   padding-left: 20px;
              // }

              &:last-child {
                // padding-right: 20px;
                border-right: none;
              }
            }

            &:hover:not(.ant-table-expanded-row):not(.table-disabled-row) > td,
            .ant-table-row-hover,
            .ant-table-row-hover > td {
              background: var(--tableHoverColor);
            }

            /* 被选中的表格⾏的样式 */
            &.table-selected-row {
              background-color: var(--tableSelectColor);

              .ant-table-cell {
                background-color: var(--tableSelectColor);
              }

              .ant-table-cell-fix-left,
              .ant-table-cell-fix-right {
                background-color: var(--tableSelectColor);
              }

              // td {
              //   border-top: 1px solid var(--colorPrimary);
              //   border-bottom: 1px solid var(--colorPrimary);

              //   &:first-child {
              //     border-left: 1px solid var(--colorPrimary);
              //   }

              //   &:last-child {
              //     border-right: 1px solid var(--colorPrimary);
              //   }
              // }
            }

            &.table-disabled-row {
              background-color: var(--tableZebraColor);

              .ant-table-cell {
                background-color: var(--tableZebraColor);
              }

              .ant-table-cell-fix-left,
              .ant-table-cell-fix-right {
                background-color: var(--tableZebraColor);
              }

              & > td {
                color: var(--colorText3);
              }
            }

            &.ant-table-row-selected {
              td {
                background-color: unset;
              }
            }
          }

          tr.ant-table-placeholder {
            td {
              // border-bottom: none !important;
            }

            .ant-table-expanded-row-fixed {
              margin: 0;
            }

            &:hover {
              td {
                background-color: transparent !important;
              }
            }
          }
        }

        // 没有scroll.y的表格 会少一行
        // .ant-table-body {
        //   .ant-table-tbody {
        //     .ant-table-row {
        //       background-color: transparent;

        //       &:nth-child(odd) {
        //         background: var(--tableZebraColor);
        //       }
        //     }
        //   }
        // }

        // }
      }

      &.ant-table-bordered {
        .ant-table-container {
          border: none;

          // 没有scroll-y时
          .ant-table-content {
            border: 1px solid var(--borderColor);
            border-radius: 6px;
            overflow: hidden;

            & > table {
              table-layout: fixed !important;
            }
          }

          // 下面是有scroll-y时
          .ant-table-header {
            border: 1px solid var(--borderColor);
            border-bottom: none;
            border-top-left-radius: 6px;
            border-top-right-radius: 6px;
          }

          .ant-table-body {
            border: 1px solid var(--borderColor);
            border-top: none;
            border-bottom-left-radius: 6px;
            border-bottom-right-radius: 6px;
          }

          .ant-table-tbody {
            tr {
              &:last-child {
                td {
                  border-bottom: none;
                }
              }
            }
          }
        }
      }

      .table-row-expand-icon {
        margin-right: 8px;
        color: var(--colorFill4);
        // position: relative;
        // top: -3px;
      }
    }

    table {
      // border: none !important;
    }

    // 表格组件嵌套高度设置100%
    .ant-spin-nested-loading {
      height: 100%;

      .ant-spin-container {
        height: 100%;
        // overflow-x: hidden !important;

        .ant-table {
          height: 100%;

          .ant-table-container {
            height: 100%;

            .ant-table-body {
              // height: 100%;
            }
          }
        }
      }
    }

    // 不显示表头
    &.hide-thead {
      .ant-table {
        .ant-table-container {
          .ant-table-thead {
            tr {
              th,
              td {
                height: 0;
                overflow: hidden;
                padding: 0;
                border: none;
              }
            }
          }
        }
      }
    }
    //去掉每一行第一列的右边线
    &.one-td-rightHide {
      .ant-table {
        tbody {
          tr {
            .ant-table-selection-column {
              width: 10px;
              border-right: none !important;
            }
          }
        }
      }
    }

    // 空元素铺满
    &.empty-fill-table {
      min-height: 180px;

      .ant-table-empty {
        .ant-table-content {
          height: 100%;
          overflow: hidden !important;
        }

        .ant-table-body,
        .ant-table-tbody {
          height: calc(100% - 40px);
        }

        table {
          height: 100%;

          .ant-table-placeholder {
            height: 100%;

            .ant-table-expanded-row-fixed {
              height: 100%;
              border: none;

              &::after {
                content: none !important;
              }
            }

            .ant-empty-normal {
              margin: 0;
              display: flex;
              align-items: center;
              justify-content: center;
              flex-direction: column;
            }
          }
        }
      }
    }

    // 表头高度自适应
    &.header-auto-height {
      .ant-table-container {
        .ant-table-thead tr th.ant-table-cell {
          white-space: pre-wrap;

          .ofs-table-cell {
            white-space: pre-wrap;
          }
        }
      }
    }
  }

  //隐藏表格前的空行
  .ant-table-tbody > .ant-table-measure-row {
    height: 0px !important;
  }

  .row-click-table {
    .ant-table-tbody {
      tr {
        &:hover {
          cursor: pointer;
        }
      }
    }
  }

  // 弹窗里的表格
  .ant-modal-body {
    .ant-table-wrapper {
      .ant-table {
        .ant-table-container {
          .ant-table-thead {
            tr {
              th {
                height: 32px;
                font-size: 12px;
              }
            }
          }

          .ant-table-tbody {
            tr {
              height: 32px;

              td {
                height: 32px;
                font-size: 12px;

                .ant-btn-link {
                  height: 16px;
                  font-size: 12px;
                  padding: 0 8px;
                }
              }
            }
          }
        }
      }
    }
  }

  .empty-table.ant-table-wrapper {
    .ant-table {
      .ant-table-header {
        height: 0;
        overflow: hidden;
      }
    }
  }

  //添加虚拟列表之后的样式修改
  .ant-table-wrapper .ant-table-tbody-virtual .ant-table-cell {
    padding: 4px 8px;
    line-height: 32px;
    min-height: 40px;
  }

  //去掉表格表头的白色阴影
  .ant-table-wrapper .ant-table-cell-scrollbar:not([rowspan]) {
    box-shadow: none !important;
  }

  /* 显示拖拽样式 */
  .react-resizable {
    position: relative;
    background-clip: padding-box;
  }

  /* 显示拖拽手势 */
  // .react-resizable-handle {
  //   position: absolute;
  //   width: 10px;
  //   height: 100%;
  //   bottom: 0;
  //   right: 0;
  //   cursor: col-resize;
  //   z-index: 6;
  // }

  .ant-table-wrapper
    .ant-table.ant-table-bordered
    > .ant-table-container
    > .ant-table-body
    > table
    > tbody
    > tr
    > td
    > .ant-table-expanded-row-fixed {
    height: 100%;
  }

  .ant-table-wrapper
    .ant-table.ant-table-bordered
    > .ant-table-container
    > .ant-table-body
    > table
    > tbody
    > tr
    > td
    > .ant-table-expanded-row-fixed::after {
    border-right: none;
  }
  //解决一开始会出现横向滚动条问题  这里要把原本表格width变为99%
  .ant-table-wrapper .ant-spin-nested-loading .ant-spin-container {
    width: 100%;
  }
}
.ant-table-container .ant-table-tbody .abnormal-row {
  background: transparent;
  .ant-table-cell {
    animation: row-ani 2s linear 0s infinite;

    @keyframes row-ani {
      0%, 100% {
        background: rgba(255, 0, 0, 0.07) ;
        box-shadow: none;
    }
      50% {
        background: rgba(255, 0, 0, 0.2);
        border-color:rgb(241, 131, 131);
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.5) inset;
      }
    }
  }
}
.ant-table-container .ant-table-tbody .about-to-expire {
  .dqsj{
    background-color: orange !important;
  }
}